<%@page import="drukarnia.controller.OrderManager"%>
<%@page import="drukarnia.controller.FTPManager"%>
<%@page import="drukarnia.model.Orders"%>
<%@page import="java.util.List"%>
<%@page import="drukarnia.model.User"%>
<%@ page errorPage="WEB-INF/bledy.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Drukarnia</title>
</head>
<body>
<h1>Szczegóły zamówienia:</h1>

<%
		User user = (User)session.getAttribute("user");
		if(user != null){
			String id = request.getParameter("id");
			int id_order = Integer.parseInt(id);
			OrderManager man = new OrderManager();
			List<Orders> orderList = man.fetchOrdersDetailsFromDB(id_order);
	%>   
	<center>
		<table style="text-align: left" >
			<tr>
				<td>Nr zamówienia: </td>
				<td><%=orderList.iterator().next().getId_order() %></td>
			</tr>
			<tr>
				<td>Nazwa pliku: </td>
				<td><%=orderList.iterator().next().getFileName() %></td>
			</tr>
<!-- 			<tr> -->
<!-- 				<td>Koszt: </td> -->
<%-- 				<td><%=orderList.iterator().next().getCost() %>zł</td> --%>
<!-- 			</tr> -->
			<tr>
				<td>Liczba kopii: </td>
				<td><%=orderList.iterator().next().getCopies() %></td>
			</tr>
			<tr>
				<td>Wybrany materiał: </td>
				<td><%=orderList.iterator().next().getTypeOfMaterials().getTypeOfMaterial() %></td>
			</tr>
			<tr>
				<td>Data złożenia zamówienia: </td>
				<td><%=orderList.iterator().next().getDate() %></td>
			</tr>
			<tr>
				<td>Priorytet: </td>
				<td><%=orderList.iterator().next().getPriority() %></td>
			</tr>
			<tr>
				<td>Status zlecenia: </td>
				<td><%=orderList.iterator().next().getStatus() %></td>
			</tr>
			<tr>
				<td>Uwagi: </td>
				<td><%=orderList.iterator().next().getUwagi() %></td>
			</tr>
<!-- 			<tr> -->
<!-- 				<td>Pliki: </td> -->
<!-- 				<td> -->
<%-- 				<%  --%>
<!-- // 				FTPManager ftp = new FTPManager(); -->
<!-- // 				ftp.polaczZFTP(); -->
<!-- // 				ftp.pokazPlikiNaSerwerze2(out,orderList.iterator().next().getId_user().getLogin()+"Album",request); -->
				
<!-- // 				//ftp.pobierzPlikiZFTP("kth.txt", "test.txt"); -->
<%-- 				%></td> --%>
<!-- 			</tr> -->
			
		</table>
	</center>
	<h2><a href="orderHistoryADMIN.jsp">Powrót</a></h2>
	 <% }else{
		 response.sendError(404,"Drukarnia: brak uprawnien");
	 	}
		 %>
</body>
</html>